import type { BookInfo, Institute } from "@/types";
import service from "@/apis/request";
import { AxiosResponse } from "axios";

const getAllBooksInfo = (): Promise<AxiosResponse<BookInfo[]>> => {
  return service.get("book");
};

const getSingleBookInfoByID = (
  id: string
): Promise<AxiosResponse<BookInfo>> => {
  return service.get(`book/${id}`);
};

const searchBooksByInfo = (
  marchFlag: string,
  info: string
): Promise<AxiosResponse<BookInfo[]>> => {
  return service.get(`book/${marchFlag}/${info}`);
};

const getInstitutesInfo = (): Promise<AxiosResponse<Institute>> => {
  return service.get(`info/institute`);
};

export {
  getAllBooksInfo,
  getSingleBookInfoByID,
  searchBooksByInfo,
  getInstitutesInfo,
};
